﻿@model IEnumerable<BiblioWebProyecto2013.Models.Material>

@helper Truncate(string input, int length)
{
    if (input.Length <= length) {
        @input
    } else {
        @input.Substring(0, length)<text>...</text>
    }
}
@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            Titulo
        </th>
        <th>
            Sinopsis
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Titulo)
        </td>
        <td>
             @Html.DisplayFor(modelItem => item.Sinopsis)
            @*@Truncate(modelItem => item.Sinopsis,25)*@
        </td>
        <td>
            @Html.ActionLink("Reservar", "Reservar", new { id=item.IdMaterial }) |
            @Html.ActionLink("Detalles", "Detalle", new { id=item.IdMaterial }) 
          
        </td>
    </tr>
}

</table>
